let path = require('path')
let htmlWebpackPlugin = require('html-webpack-plugin')
let webpack = require('webpack')
let { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = {
  mode: 'production',
  entry: './src/index.js',
  output: {
    filename: "index.[contenthash:8].js",
    // fullhash  chunkhash  contenthash
    /*  */
    path: path.resolve(__dirname, 'dist') // path.resolve path.join
  },
  plugins: [
    new htmlWebpackPlugin({
      template: './public/index.html',
      minify: false
    }),
    new CleanWebpackPlugin(),
    new webpack.DefinePlugin({
      // 定义的是一些编译阶段的全局变量
      BASEURL: JSON.stringify("https://baidu.com"),
      BASEURL2: '"https://baidu.com"',
      Flag: 'true',
      obj: {
        qqq: "'qqq字符串'"
      },
      // process: {
      //   env: {
      //     NODE_ENV: "'qqq'"
      //   }
      // }
    })
  ]
}